﻿#region codejockey.net Copyright Banner
/***************************************************************\
 * Copyright 2010 codejockey.net.                                *
 *                                                               *
 * This code is property of codejockey.net and cannot be used    *
 * without explicit permission given by a codejockey.net         *
 * Representative.  For details contact: source@codejockey.net   *
 \***************************************************************/
#endregion

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace codejockey.BingPaper.Configuration
{
  public class BingPaperConfigElement : ConfigurationElement
  {
    /// <summary>
    /// WallPaper specific settings are contained here.
    /// </summary>
    [ConfigurationProperty("wallPaper")]
    public BingPaperWallPaperConfigElement WallPaper
    {
      get { return (BingPaperWallPaperConfigElement)base["wallPaper"]; }
      set { base["wallPaper"] = value; }
    }

    [ConfigurationProperty("autoRefresh")]
    public BingPaperAutoRefreshConfigElement AutoRefresh
    {
      get { return (BingPaperAutoRefreshConfigElement)base["autoRefresh"]; }
      set { base["autoRefresh"] = value; }
    }

    [ConfigurationProperty("defaultCountry", DefaultValue = "us", IsRequired = false)]
    public string DefaultCountry
    {
      get { return (string)base["defaultCountry"]; }
      set { base["defaultCountry"] = value; }
    }

    [ConfigurationProperty("archive")]
    public BingPaperArchiveConfigElement Archive
    {
      get { return (BingPaperArchiveConfigElement)base["archive"]; }
      set { base["archive"] = value; }
    }

    /// <summary>
    /// The BaseURL proprety should rarely be used.  This value allows you to strictly control which
    /// web server is hit allowing testing to be done without actually making queries to the production Bing
    /// web server.
    /// </summary>
    [ConfigurationProperty("baseURL", DefaultValue = "http://www.bing.com", IsRequired = false)]
    public string BaseURL
    {
      get { return (string)base["baseURL"]; }
      set { base["baseURL"] = value; }
    }

    [ConfigurationCollection(typeof(BingPaperTokenConfigElement), CollectionType = ConfigurationElementCollectionType.BasicMap)]
    [ConfigurationProperty("tokens")]
    public NamedElementCollection<BingPaperTokenConfigElement> Tokens
    {
      get { return (NamedElementCollection<BingPaperTokenConfigElement>)base["tokens"]; }
      set { base["tokens"] = value; }
    }
  }
}
